<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8" />
		<title>流程列表</title>
		<div th:replace="common/common_grid_header"></div>
		<script type="text/javascript">

			$(function () {
			
				var params = {
					searchParams:{
						userId:"kermit"
					}
				};
			    var url = "/process/instance/list/data";
			    $("#dg").datagrid({
				    method:'post',
				    url:url,
				   	autoRowHeight:false,
				   	fit:true,
				   	remoteSort:true,
				   	border:false,
				   	rownumbers: true,
				   	pagination:true,
				   	fitColumns:true,
				   	singleSelect:true,
				   	multiSort:true,
				   	pageSize:15,
				   	pageList:[15,30,50,100],
				   	queryParams:params,
				   	onBeforeLoad : function(param){
				   		var size = param.rows; //保存下值
				   		delete param.rows; //删掉
				   		param.size = size; //重新命名
				   	},
				   	columns:[[ 
			            {field:'name',title:'name',width:150,sortable:true},
			            {field:'key',title:'key',width:100},
						{field:'deploymentId',title:'deploymentId',width:60,sortable:true},
						{field:'revision',title:'revision',width:60,sortable:true},
						{field:'processonDefinitionId',title:'processonDefinitionId',width:120,sortable:true},
						{field:'action',title:'操作',width:80,formatter:fmtAction,align:'center'}
				    ]]
			    });
			});
			
			function fmtAction(v,r){
				return "<a href=javascript:startProcess('"+r.key+"') >启动<a/>";
			}
			
			function startProcess(key){
				location.href = "/process/start/"+key;
			}
		</script>
	</head>
	<body>
		<table id="dg" ></table>
	</body>
</html>